import React,{Component} from 'react';
import {View,Text} from 'react-native';

export default class Demo22Component extends Component{
  constructor(){
    super();
    this.state = {
      list:[100,200,300]
    }
  }

  /* 
      React.Children.map
       (this.props.children,
        function(child){return child}
        )
  */

  //将遍历数组的代码封装成一个方法
  showList=()=>{
    return this.state.list
        .map(function(child){
          return <Text>{child}</Text>
        })
  }

  render(){
    return <View>
      {
        this.showList()
      }
    </View>
  }
}